<?php

/**
 * Author filter form base class.
 *
 * @package    myarticles
 * @subpackage filter
 * @author     Apul Gupta<apulmca2k4@gmail.com>
 */
abstract class BaseAuthorFormFilter extends BaseFormFilterPropel
{
  public function setup()
  {
    $this->setWidgets(array(
      'url_slug'         => new sfWidgetFormFilterInput(array('with_empty' => false)),
      'meta_keyword'     => new sfWidgetFormFilterInput(array('with_empty' => false)),
      'meta_description' => new sfWidgetFormFilterInput(array('with_empty' => false)),
      'email_id'         => new sfWidgetFormFilterInput(array('with_empty' => false)),
      'password'         => new sfWidgetFormFilterInput(array('with_empty' => false)),
      'first_name'       => new sfWidgetFormFilterInput(array('with_empty' => false)),
      'last_name'        => new sfWidgetFormFilterInput(array('with_empty' => false)),
      'phone'            => new sfWidgetFormFilterInput(),
      'fax'              => new sfWidgetFormFilterInput(),
      'business_name'    => new sfWidgetFormFilterInput(),
      'address1'         => new sfWidgetFormFilterInput(),
      'address2'         => new sfWidgetFormFilterInput(),
      'city'             => new sfWidgetFormFilterInput(),
      'state'            => new sfWidgetFormFilterInput(),
      'country'          => new sfWidgetFormFilterInput(),
      'postal_code'      => new sfWidgetFormFilterInput(),
      'about_yourself'   => new sfWidgetFormFilterInput(),
      'web_url'          => new sfWidgetFormFilterInput(),
      'photo'            => new sfWidgetFormFilterInput(),
      'last_active'      => new sfWidgetFormFilterDate(array('from_date' => new sfWidgetFormDate(), 'to_date' => new sfWidgetFormDate())),
      'created_at'       => new sfWidgetFormFilterDate(array('from_date' => new sfWidgetFormDate(), 'to_date' => new sfWidgetFormDate())),
      'updated_at'       => new sfWidgetFormFilterDate(array('from_date' => new sfWidgetFormDate(), 'to_date' => new sfWidgetFormDate())),
      'is_active'        => new sfWidgetFormFilterInput(),
    ));

    $this->setValidators(array(
      'url_slug'         => new sfValidatorPass(array('required' => false)),
      'meta_keyword'     => new sfValidatorPass(array('required' => false)),
      'meta_description' => new sfValidatorPass(array('required' => false)),
      'email_id'         => new sfValidatorPass(array('required' => false)),
      'password'         => new sfValidatorPass(array('required' => false)),
      'first_name'       => new sfValidatorPass(array('required' => false)),
      'last_name'        => new sfValidatorPass(array('required' => false)),
      'phone'            => new sfValidatorPass(array('required' => false)),
      'fax'              => new sfValidatorPass(array('required' => false)),
      'business_name'    => new sfValidatorPass(array('required' => false)),
      'address1'         => new sfValidatorPass(array('required' => false)),
      'address2'         => new sfValidatorPass(array('required' => false)),
      'city'             => new sfValidatorPass(array('required' => false)),
      'state'            => new sfValidatorPass(array('required' => false)),
      'country'          => new sfValidatorPass(array('required' => false)),
      'postal_code'      => new sfValidatorPass(array('required' => false)),
      'about_yourself'   => new sfValidatorPass(array('required' => false)),
      'web_url'          => new sfValidatorPass(array('required' => false)),
      'photo'            => new sfValidatorPass(array('required' => false)),
      'last_active'      => new sfValidatorDateRange(array('required' => false, 'from_date' => new sfValidatorDate(array('required' => false)), 'to_date' => new sfValidatorDate(array('required' => false)))),
      'created_at'       => new sfValidatorDateRange(array('required' => false, 'from_date' => new sfValidatorDate(array('required' => false)), 'to_date' => new sfValidatorDate(array('required' => false)))),
      'updated_at'       => new sfValidatorDateRange(array('required' => false, 'from_date' => new sfValidatorDate(array('required' => false)), 'to_date' => new sfValidatorDate(array('required' => false)))),
      'is_active'        => new sfValidatorSchemaFilter('text', new sfValidatorInteger(array('required' => false))),
    ));

    $this->widgetSchema->setNameFormat('author_filters[%s]');

    $this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema);

    parent::setup();
  }

  public function getModelName()
  {
    return 'Author';
  }

  public function getFields()
  {
    return array(
      'id'               => 'Number',
      'url_slug'         => 'Text',
      'meta_keyword'     => 'Text',
      'meta_description' => 'Text',
      'email_id'         => 'Text',
      'password'         => 'Text',
      'first_name'       => 'Text',
      'last_name'        => 'Text',
      'phone'            => 'Text',
      'fax'              => 'Text',
      'business_name'    => 'Text',
      'address1'         => 'Text',
      'address2'         => 'Text',
      'city'             => 'Text',
      'state'            => 'Text',
      'country'          => 'Text',
      'postal_code'      => 'Text',
      'about_yourself'   => 'Text',
      'web_url'          => 'Text',
      'photo'            => 'Text',
      'last_active'      => 'Date',
      'created_at'       => 'Date',
      'updated_at'       => 'Date',
      'is_active'        => 'Number',
    );
  }
}
